from wtforms import Form, validators
from wtforms import StringField, IntegerField, PasswordField, DateTimeField


class ApplyForm(Form):
    stu_name = StringField('stu_name', [validators.Length(min=1, max=25)])
    stu_id = StringField('stu_id', [validators.Length(min=11, max=20)])
    stu_phone = StringField('stu_phone', [validators.Length(min=11, max=20)])
    parent_phone = StringField('parent_phone', [validators.Length(min=11, max=20)])
    start_time = DateTimeField('start_time', format='%Y-%m-%d %H:%M')
    stop_time = DateTimeField('stop_time', format='%Y-%m-%d %H:%M')
    reason = StringField('reason', [validators.Length(min=1, max=255)])
    location = StringField('location', [validators.Length(min=1, max=255)])


class StuQueryForm(Form):
    stu_name = StringField('stu_name', [validators.Length(min=1, max=25)])
    stu_id = StringField('stu_id', [validators.Length(min=11, max=20)])


class LoginForm(Form):
    username = StringField('username', [validators.required()])
    password = StringField('password', [validators.required()])


class InspectForm(Form):
    demand_id = StringField('demand_id', [validators.required()])
    state = IntegerField('state', [validators.required()])


class HistoryForm(Form):
    start_time = DateTimeField('start_time', format='%Y-%m-%d %H:%M')
    stop_time = DateTimeField('stop_time', format='%Y-%m-%d %H:%M')
    limit = IntegerField('limit')
